﻿using System;
using System.Reflection;
using log4net;
using log4net.Config;

namespace Pantry.Commons
{
    public static class ExceptionHandler
    {
        private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);


        /// <summary>
        /// Log exception to windows events
        /// </summary>
        /// <param name="ex"></param>
        public static void WriteErrorLog(Exception ex)
        {
            // Log exception
            XmlConfigurator.Configure();
            Log.Error("Application Exception: " + ex.Message + " - StackTrace=" + ex.StackTrace, ex);
        }
    }
}
